package Offer2018;

/**
 * Created by 雷文康 on 2018/3/3.
 */
public class Test14 {

    public static void adjustArray(int[] array) {
        if (array == null || array.length == 0) {
            return;
        }
        int start = 0;
        int end = array.length - 1;
        while (start < end) {
            while (start < end && (array[start] & 1) == 1) {
                start++;
            }
            while (start < end && (array[end] & 1) == 0) {
                end--;
            }
            if (start < end) {
                int temp = array[start];
                array[start] = array[end];
                array[end] = temp;
            }
        }
    }
}
